package A009list_set;

import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArraySet;

public class J003_Set县城安全例子CopyOnWriteArraySet {
    public static void main(String[] args) {

        Set<String> set = new CopyOnWriteArraySet<String>();

        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                set.add(UUID.randomUUID().toString().substring(0, 8));
                System.out.println(set);
            }, String.valueOf(i)).start();
        }
    }
}
